<?php
header("Content-type: text/html; charset=utf-8");
session_start();
include('../comm/config.php');

if($_GET['act']=='' or $_GET['ortherwebname']==''){
    echo "缺少必要参数！";
	exit;
}

if($_GET['act']=='del'){
    $sql="delete from ".$BIAOTOU."apilogin where dduserid=".$_SESSION['dduserid']." and ortherwebname='".$_GET['ortherwebname']."'";
	mysql_query($sql);
	echo "<script>alert('解除完成！');window.location='info.php?cur=binding'</script>";
}
elseif($_GET['act']=='add'){
    $_SESSION["duoduouser"] = NULL;
    $_SESSION["dduserid"] = NULL;
    $_SESSION["dduserlevel"] = NULL;
    setcookie("ddusername",NULL, time()-42000, '/',SURL);
    setcookie("ddpassword",NULL, time()-42000, '/',SURL);
	
	switch($_GET['ortherwebname']){
	    case 'QQ空间': echo "<script>window.location='../api/qqspace/oauth/redirect_to_login.php'</script>";
		break;
		case '淘宝': echo "<script>window.location='../api/login_tb/login.php'</script>";
		break;
		case '支付宝': echo "<script>window.location='../api/alipay/auth_authorize.php'</script>";
		break;
		case 'QQ微博': echo "<script>window.location='../api/qqweibo/'</script>";
		break;
		case '新浪微博': echo "<script>window.location='../api/sina/'</script>";
		break;
		break;
		case '开心网': echo "<script>window.location='../api/kaixin/'</script>";
		break;
	}
}

mysql_close();